#include <iostream>
using namespace std;

int main(){
//	freopen("in.txt","r",stdin);
	int n,d;
	cin >> n >> d;
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];
	int i = 0;
	for(; i<n&&a[i]-a[0]<=d; i++);
	unsigned long long sum = 0;
	cout << sum << endl;
	if( i>=3 )
		sum = ((unsigned long long)i*(i-1)*(i-2)/(unsigned long long)6)% (unsigned long long)99997867;
	cout << sum << endl;
	cout << i << endl;
	for( int j=0; i<n; i++){
		while( a[i]-a[j]>d ) j++;
		if( i-j>=2 )
			sum = (sum + ((unsigned long long)(i-j)*(unsigned long long)(i-j-1)/(unsigned long long)2) )% (unsigned long long)99997867;
		cout << sum << " ";
//		printf("%lld ",sum);
	}	
	cout << sum % 99997867;
}
